import { Map1Data, Map2Data, Map1InitPos, Map2InitPos } from './../GameDefine';

export default class GameMapModel {
    private static _instance: GameMapModel = null;
    public static getInstance(): GameMapModel {
        if(this._instance == null){
            this._instance = new GameMapModel();
        }
        return this._instance;
    }


    private _data: number[][] = [];
    public get data() {
        return this._data;
    }

    public init(mapId: number): void {
        this._data.length = 0;
        if(mapId == 1){
            for(let i = 0; i < Map1Data.length; i++){
                let _subData = [];
                Object.assign(_subData, Map1Data[i]);

                this._data.push(_subData);
            }
        }else{
            for(let i = 0; i < Map2Data.length; i++){
                let _subData = [];
                Object.assign(_subData, Map2Data[i]);

                this._data.push(_subData);
            }
        }
    }

    public getRoleInitPos(mapId: number): cc.Vec2{
        if(mapId == 1){
            return Map1InitPos;
        }else{
            return Map2InitPos;
        }
    }

    public getBossPos(): cc.Vec2{
        return cc.v2(7,9);
    }
}